/**
 * 
 */
package game.kill.enums;

/**
 * @author leiruiqi
 *
 */
public enum PlayerRoleEnum {

	
	
	everyman(new PlayerActionEnum[]{PlayerActionEnum.speak,PlayerActionEnum.vote},1),
	
	killer(new PlayerActionEnum[]{PlayerActionEnum.kill,PlayerActionEnum.speak,PlayerActionEnum.vote},2),
	
	police(new PlayerActionEnum[]{PlayerActionEnum.speak,PlayerActionEnum.vote,PlayerActionEnum.check},3),
	
	//dead(PlayerActionEnum.speak),
	;
	
	private PlayerActionEnum[] actions;
	
	private Integer code;
	
	public PlayerActionEnum[] getActions() {
		return actions;
	}



	public Integer getCode() {
		return code;
	}



	private PlayerRoleEnum(PlayerActionEnum[] actions,Integer code) {
		this.actions = actions;
		this.code = code;
	}
	
	public static PlayerRoleEnum getByCode(Integer code){
		for(PlayerRoleEnum playerRole:PlayerRoleEnum.values()){
			if(playerRole.getCode() == code){
				return playerRole;
			}
		}
		return null;
	}
}
